package com.dji.ux.sample.VirtualSticks;

import java.util.TimerTask;

import dji.common.error.DJIError;
import dji.common.flightcontroller.virtualstick.FlightControlData;
import dji.common.util.CommonCallbacks;
import dji.sdk.flightcontroller.FlightController;

public class SendVirtualStickDataTask extends TimerTask {

    private FlightController mFlightController;
    public float mPitch,mRoll,mYaw,mThrottle = 0;


    public SendVirtualStickDataTask(FlightController flightcontroller){
        mFlightController = flightcontroller;
    }

    @Override
    public void run() {
        if (mFlightController != null) {
            mFlightController.sendVirtualStickFlightControlData(
                    new FlightControlData(
                            mPitch, mRoll, mYaw, mThrottle
                    ), new CommonCallbacks.CompletionCallback() {
                        @Override
                        public void onResult(DJIError djiError) {

                        }
                    }
            );
        }
    }
}

